package cn.jingzhuan.fm.ui.fragment

import android.app.Dialog
import android.os.Bundle
import android.support.design.widget.BottomSheetDialogFragment
import android.util.Log
import cn.jingzhuan.fm.R
import cn.jingzhuan.fm.databinding.FragmentFmAudioPlayListBinding
import com.jakewharton.rxbinding2.view.RxView
import io.reactivex.android.schedulers.AndroidSchedulers


class FMAudioPlayListFragment : BaseBindingBottomSheetDialogFragment<FragmentFmAudioPlayListBinding> () {

    companion object {
        val ARG_ALBUM_ID = "albumId"
        fun newInstance(albumId: String): FMAudioPlayListFragment {
            val args = Bundle()
            val fragment = FMAudioPlayListFragment()
            args.putString(ARG_ALBUM_ID, albumId)
            fragment.arguments = args
            return fragment
        }
    }

    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
        setStyle(BottomSheetDialogFragment.STYLE_NORMAL, R.style.bottom_sheet_transparent_background)
        return super.onCreateDialog(savedInstanceState)
    }

    override fun onDataBind(savedInstanceState: Bundle?, binding: FragmentFmAudioPlayListBinding) {
        initListener()
    }

    private fun initListener() {
        this.mBinding.closePlayList.setOnClickListener {
             // 关闭弹窗
             this.dismiss()
        }

    }

    override fun onDestroy() {
        Log.i("FMAudioPlayList","FMAudioPlayListFragment is Destoryed!!")
        super.onDestroy()
    }

    override fun getLayoutId(): Int = R.layout.fragment_fm_audio_play_list
}